#include "networkpostrequest.h"
#include <QNetworkAccessManager>
#include <QNetworkRequest>

namespace Network {

PostRequest::PostRequest(QObject *parent) :
    HttpRequest(parent)
{
}

QNetworkReply *PostRequest::post(QNetworkAccessManager &manager, const QUrl &url) const
{
    QNetworkRequest request(url);
    request.setHeader(QNetworkRequest::ContentTypeHeader, format());
    QByteArray data = this->data();
    request.setHeader(QNetworkRequest::ContentLengthHeader, data.length());
    return manager.post(request, data);
}

} // namespace Network
